#include <iostream>
#include <deque>

using namespace std;

int s, n;

string row[50];

// quite bad design here, but it works anyway
string c[10] = 
{
"-|| ||-", 
"  |  | ", 
"- |-| -", 
"- |- |-", 
" ||- | ", 
"-| - |-", 
"-| -||-", 
"- |  | ", 
"-||-||-", 
"-||- |-"

};

void printNo(int k)
{
	if (k < 0 || 9 < k) 
	{
		cerr << "not a digit" << endl;
		return;
	}
	
	string spc = "";
	for (int i = 0; i < s; i++) spc += " ";

	string ss[7];
	for (int i = 0; i < 7; i++) 
	{
		ss[i] = "";
		for (int j = 0; j < s; j++) ss[i] += c[k][i];
	}
	string sp = " ";

	row[0] += sp + ss[0] + sp;

	for (int i = 1; i <= s; i++)
		row[i] += c[k][1] + spc + c[k][2];

	row[s+1] += sp + ss[3] + sp;

	for (int i = s+2; i <= 2*s+1; i++) 
		row[i] += c[k][4] + spc + c[k][5];

	row[2*s+2] += sp + ss[6] + sp;
}


int main()
{
	while (true)
	{
		cin >> s >> n;
		if (s == 0 && n == 0) break;
		
		deque<int> dig;
		dig.clear();

		if (n == 0) dig.push_back(0);
		while (n > 0)
		{
			dig.push_back(n % 10);
			n /= 10;
		}


		for (int i = 0; i < 2*s+3; i++) row[i] = "";

		while (!dig.empty())
		{
			int k = dig.back();
			dig.pop_back();
			printNo(k);
			if (!dig.empty()) 
				for (int i = 0; i < 2*s + 3; i++) row[i] += " ";
		}

		for (int i = 0; i < 2*s+3; i++) cout << row[i] << endl;
		cout << endl;
	}
	return 0;
}
